﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Web.Core;
using Web.Core.Objects;
using System.Globalization;

public partial class MasterPage : System.Web.UI.MasterPage
{
    public string title;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Language"] == null)
        {
            Session["Language"] = GlobalStorage.Language.Vietnamese;
            Resources.Lang.Culture = new CultureInfo("vi");
        }
        if (Session["Currency"] == null)
            Session["Currency"] = Currencies.GetCurrenciesByName("US Dollar");
        HandleTopMenu();
    }

    void HandleTopMenu()
    {
        this.title = "Trang chu";
        string tab = Request.Params["act"];
        if (tab!=null)
        {
            switch (tab.ToLower())
            {
                case "about":
                    this.menu2.Attributes["Class"] = "active";
                    this.title = "Gioi thieu";
                    break;
                case "project":
                    this.menu3.Attributes["Class"] = "active";
                    this.title = "Du an";
                    break;
                case "client":
                    this.menu4.Attributes["Class"] = "active";
                    this.title = "Doi tac";
                    break;
                case "news":
                    this.menu5.Attributes["Class"] = "active";
                    this.title = "Tin tuc";
                    break;
                case "gallery":
                    this.menu6.Attributes["Class"] = "active";
                    this.title = "Thu vien anh";
                    break;
                case "pattern":
                    this.menu7.Attributes["Class"] = "active";
                    this.title = "Mau mau";
                    break;
                case "contact":
                    this.menu8.Attributes["Class"] = "active";
                    this.title = "Lien he";
                    break;
                default:
                    this.menu1.Attributes["class"] = "active";
                    this.title = "Trang chu";
                    break;
            }
        }
        else
            this.menu1.Attributes["class"] = "active";
    }
}
